package Thread;

//第一种创建线程的方式是继承Thread
class MyThread extends Thread{
    static int count = 0;
    @Override
    public void run(){
        while (true){
            System.out.println(count++);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
public class Test01 {
    public static void main(String[] args) throws InterruptedException {
        MyThread t  = new MyThread();
        t.start();
        while (true){
            System.out.println("我是主线程");
            Thread.sleep(1000);
        }


    }
}
